<script setup lang="ts">
  // import { S } from 'mockjs';
  import { formatToDateTime } from '@/utils/dateUtil';
  import { ref } from 'vue';
  // import { defineProps } from 'vue';
  // eslint-disable-next-line vue/no-setup-props-destructure
  export interface Item {
    blindBoxId: number;
    blindBoxName: string;
    blindBoxNum: number;
    createTime: number;
    id: number;
    memberId: number;
    memberMobile: string;
    memberName: string;
    nickname: string;
    orderSn: string;
    payTime: number;
    paymentOrderNo: string;
    price: number;
    priceRule: object;
    status: number;
  }
  const { item } = defineProps<{
    item: Item;
  }>();
 
  // formatToDateTime(item.createTime);
  const createTime = ref<number>(0);
  createTime.value = item.createTime * 1000; //创建时间
  const payTime = ref<number>(0);
  payTime.value = item.payTime * 1000; // 支付时间
</script>

<template>
  <div class="message">
    <div class="order-msg-content">
      <n-descriptions label-placement="left" title="订单信息">
        <n-descriptions-item>
          <template #label> 盲盒名称 </template>
          {{ item.blindBoxName }}
        </n-descriptions-item>
        <n-descriptions-item label="抽奖次数"> {{ item.blindBoxNum }} </n-descriptions-item>
        <n-descriptions-item label="创建时间">
          {{ formatToDateTime(createTime) }}
        </n-descriptions-item>
        <n-descriptions-item label="会员手机号"> {{ item.memberMobile }} </n-descriptions-item>
        <n-descriptions-item label="会员名称"> {{ item.memberName }} </n-descriptions-item>
        <n-descriptions-item label="会员昵称"> {{ item.nickname }} </n-descriptions-item>
        <n-descriptions-item label="订单编号"> {{ item.orderSn }} </n-descriptions-item>
        <n-descriptions-item label="支付时间">
          {{ payTime ? formatToDateTime(payTime) : '' }}
        </n-descriptions-item>
        <n-descriptions-item label="第三方支付单号">
          {{ item.paymentOrderNo }}
        </n-descriptions-item>
        <n-descriptions-item label="订单总价">
          {{ item.price }}
        </n-descriptions-item>
        <n-descriptions-item label="订单状态">
          {{ getBlindOrderStatus(item.status) }}
        </n-descriptions-item>
      </n-descriptions>
    </div>
  </div>
</template>
<script lang="ts">
import { getBlindOrderStatus } from '../orderStatusEnum';
</script>
<style scoped lang="less"></style>
